<!--
 * @Author: liyaqi liyaqi0126@163.com
 * @Date: 2024-09-05 09:47:00
 * @LastEditors: liyaqi liyaqi0126@163.com
 * @LastEditTime: 2024-09-07 16:53:39
 * @FilePath: \FinancialLeasing-FG-FLCompany\src\views\systemConfig\overdue\index.vue
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
-->
<template>
    <div class="app-container">
        <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" :rules="rules">
            <el-form-item label="逾期宽限期：" prop="overdueDay">
                <el-input v-model="queryParams.overdueDay" placeholder="请输入逾期宽限期">
                    <span slot="append">日</span>
                </el-input>
                <!-- <el-input-number v-model="queryParams.overdueDay" :min="1" :max="10" label="描述文字"></el-input-number> -->
            </el-form-item>
            <el-form-item>
                <el-button type="primary" size="mini" @click="handleSave">保存</el-button>
            </el-form-item>
        </el-form>
      
    </div>
</template>
  
<script>
import { getOverdueDay, addOverdue } from '@/api/systemConfig/overdue'

export default {
    name: 'overdue',
    dicts: [],
    data() {
        return {
            // 遮罩层
            // loading: true,
            loading: false,
            // 查询参数
            queryParams: {
                overdueDay: undefined,
            },
            // 表单校验
            rules: {
                overdueDay: [
                    { required: true, message: '逾期宽限期不能为空', trigger: 'blur' },
                    {
                        pattern: /^(([1-9]{1}\d*)|(0{1}))(\.\d{1,2})?$/,
                        required: true,
                        message: '请输入正整数',
                        trigger: 'blur'
				    },
                ],
            }
        }
    },
    created() {
        this.getList()
    },
    methods: {
        /** 查询查询逾期天数 */
        getList() {
            this.loading = true
            getOverdueDay().then(response => {
                this.queryParams.overdueDay = response.data
                this.loading = false
            }
            )
        },

        /** 保存按钮操作 */
        handleSave() {
            let params = {
                overdueDay: parseInt(this.queryParams.overdueDay)
            }
            addOverdue(params).then(response => {
                this.$modal.msgSuccess('保存成功')
                this.getList()
            })
        },      

    }
}
</script>